<?php
//20210616 传递appid 和appecret就能返回token，顺手做埋分割吧

function wechat_get_token($config){
//配置参数的数组
    $CONF = array(
        '__APPID__'    => $config['appid'],
        '__SERECT__'   => $config['appsecret'],
    );


    $getCodeUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential" .
        "&appid=" . $CONF['__APPID__'] .
        "&secret=" . $CONF['__SERECT__'];


    $result = substr(file_get_contents($getCodeUrl), 17,157);

    return $result;
}
?>